/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author timoteus78
 */
@Entity
@Table(name = "Review")
@NamedQueries({@NamedQuery(name = "Review.findByRID", query = "SELECT r FROM Review r WHERE r.reviewPK.rID = :rID"), @NamedQuery(name = "Review.findByMID", query = "SELECT r FROM Review r WHERE r.reviewPK.mID = :mID"), @NamedQuery(name = "Review.findByUName", query = "SELECT r FROM Review r WHERE r.uName = :uName"), @NamedQuery(name = "Review.findByRDescription", query = "SELECT r FROM Review r WHERE r.rDescription = :rDescription")})
public class Review implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ReviewPK reviewPK;
    @Column(name = "uName")
    private String uName;
    @Column(name = "rDescription")
    private String rDescription;

    public Review() {
    }

    public Review(ReviewPK reviewPK) {
        this.reviewPK = reviewPK;
    }

    public Review(short rID, short mID) {
        this.reviewPK = new ReviewPK(rID, mID);
    }

    public ReviewPK getReviewPK() {
        return reviewPK;
    }

    public void setReviewPK(ReviewPK reviewPK) {
        this.reviewPK = reviewPK;
    }

    public String getUName() {
        return uName;
    }

    public void setUName(String uName) {
        this.uName = uName;
    }

    public String getRDescription() {
        return rDescription;
    }

    public void setRDescription(String rDescription) {
        this.rDescription = rDescription;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reviewPK != null ? reviewPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Review)) {
            return false;
        }
        Review other = (Review) object;
        if ((this.reviewPK == null && other.reviewPK != null) || (this.reviewPK != null && !this.reviewPK.equals(other.reviewPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.Review[reviewPK=" + reviewPK + "]";
    }

}
